Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: Changing MIME text drops some attachments
Feedback Type: Problem
Product Area: Notes Client
Technical Area: Customization
Platform: Windows XP client
Release: 8.5
Reproducible: Always

Hi

I've seen several posts in this area, but not describing my scenario exactly.

I have a simple document with a single Body field which uses MIME.

The Body field contains some text and a couple of attachments.

I have a piece of code that does a replace on a piece of text within the Body field and then re-writes it using SetContentFromText. This works fine, however 99% of the time its drops one or more of the attachments from the document...

I'm starting to think its a bug, but has anyone come across this one ?

Thanks..

Alan.

Sample Code as follows:

*******************************
Sub Click(Source As Button)
Dim s As New NotesSession
Dim db As NotesDatabase
Dim col As NotesDocumentCollection
Dim doc As NotesDocument
Dim mime As NotesMimeEntity
Dim child As NotesMimeEntity
Dim stream As NotesStream
Dim orig_Body As Variant
Dim new_Body As Variant

s.ConvertMIME = False

Set db = s.CurrentDatabase
Set stream = s.CreateStream

Set col = db.UnprocessedDocuments
Set doc = col.GetFirstDocument
Set mime = doc.GetMIMEEntity

Set child = mime.GetFirstChildEntity
While Not(child Is Nothing)

encodingType = Cstr(child.encoding)
Select Case encodingType
Case "1727"
encodingType =ENC_BASE64
Case "1731"
encodingType =ENC_EXTENSION
Case "1728"
encodingType =ENC_IDENTITY_7BIT
Case "1729"
encodingType =ENC_EXTENSION
Case "1731"
encodingType =ENC_IDENTITY_8BIT
Case "1730"
encodingType =ENC_IDENTITY_BINARY
Case "1725"
encodingType =ENC_NONE
Case "1726"
encodingType =ENC_QUOTED_PRINTABLE
End Select

If child.ContentSubType = "html" Then

orig_Body = child.ContentAsText

If Instr(1,orig_Body,"blah") > 0 Then
new_Body = Replace(orig_Body,"blah","BLAH",1)
End If

'####### Do text replacement here...
Call stream.WriteText(new_Body)

'##### Re-write the mime content using the origional encoding type
Call child.SetContentFromText(stream, "text/html; charset=US-ASCII", encodingType)
Call stream.Close
Call stream.Truncate
End If

Set child = child.GetNextSibling
Wend

'##### Close the Mime entity and save the doc
Call doc.CloseMIMEEntities(True, "Body")
Call doc.Save(True,False)
s.ConvertMIME = True
End Sub


Feedback number WEBB7X9DJA created by ~Sigmund Nonaburoni on 10/28/2009

Status: Open
Comments:

Changing MIME text drops some attac... (~Sigmund Nonabu... 28.Oct.09)
. . Fwd'd to development (~Dexter Opjipyb... 28.Oct.09)
. . . . Will do, will post the outcome, tha... (~Sigmund Nonabu... 28.Oct.09)
. . . . . . SOLUTION (~Sigmund Nonabu... 20.May.10)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS